package com.mdd.common.enums;

import java.util.*;

public enum LogMoneyEnum {

    /**
     * 用户余额类型
     */
    UM_INC_ADMIN(1001, "平台增加余额"),
    UM_DEC_ADMIN(1002, "平台减少余额"),
    UM_INC_RECHARGE(1003, "充值余额增加"),
    UM_DEC_RECHARGE(1004, "充值余额退回"),
    UM_DEC_PAY_ORDER(1005, "下单扣减余额"),
    UM_DEC_PAY_KUAIDI(1006,"快递下单扣减余额"),
    
    /**
     * 	积分变动类型
     */
    UI_INC_GOODS(1001,"订单返金币增加"),
    UI_DEC_GOODS(1002,"金币购物扣减"),
    UI_INC_SHARE(1003,"分享产品增加"),
    UI_INC_ADMIN(1004,"平台增加金币"),
	UI_DEC_ADMIN(1005,"平台减少金币"),
	UI_INC_CANCEL_ORDER(1006,"取消订单退还余额"),
	UI_INC_AFTER_SALE(1007,"售后退还余额"),
    
    
    
    UE_INC_GOODS(1001,"佣金增加"),
    UE_DEC_GOODS(1002,"佣金减少"),
    
    
    

    BNW_INC_CANCEL_ORDER(1201, "取消订单退还余额"),
    BNW_INC_AFTER_SALE(1202, "售后退还余额"),
    BNW_INC_WITHDRAW(1203, "提现至余额"),
	BNW_INC_KUAIDI_CANCEL(1204,"快递取消订单退还余额");

    /**
     * 构造方法
     */
    private final int code;
    private final String msg;
    LogMoneyEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * 获取状态码
     *
     * @author fzr
     * @return Long
     */
    public int getCode() {
        return this.code;
    }

    /**
     * 获取提示
     *
     * @author fzr
     * @return String
     */
    public String getMsg() {
        return this.msg;
    }

    /**
     * 根据编码获取Msg
     *
     * @author fzr
     * @param code 类型
     * @return String
     */
    public static String getMsgByCode(Integer code){
        for(LogMoneyEnum enumItem : LogMoneyEnum.values()) {
            if (enumItem.getCode() == code) {
                return enumItem.getMsg();
            }
        }
        return null;
    }

    /**
     * 获取所有类型
     *
     * @author fzr
     * @return String
     */
    public static Map<Integer, String> getTypeList(){
        Map<Integer, String> map = new LinkedHashMap<>();
        for(LogMoneyEnum enumItem : LogMoneyEnum.values()) {
            map.put(enumItem.getCode(), enumItem.getMsg());
        }
        return map;
    }
    
    
    public static Map<Integer, String> getIntegralTypeList(){
        Map<Integer, String> map = new LinkedHashMap<>();
        map.put(UI_INC_GOODS.getCode(), UI_INC_GOODS.getMsg());
        map.put(UI_DEC_GOODS.getCode(), UI_DEC_GOODS.getMsg());
        map.put(UI_INC_SHARE.getCode(), UI_INC_SHARE.getMsg());
        map.put(UI_INC_ADMIN.getCode(), UI_INC_ADMIN.getMsg());
        map.put(UI_DEC_ADMIN.getCode(), UI_DEC_ADMIN.getMsg());
        return map;
    }

    
    public static String getMsgByCodeIntegral(Integer code){
    	String msg = "";
        switch (code) {
		case 1001:
			msg = UI_INC_GOODS.getMsg();
			break;
		case 1002:
			msg = UI_DEC_GOODS.getMsg();
			break;
		case 1003:
			msg = UI_INC_SHARE.getMsg();
			break;
		case 1004:
			msg = UI_INC_ADMIN.getMsg();
			break;
		case 1005:
			msg = UI_DEC_ADMIN.getMsg();
			break;
		}
        return msg;
    }
    /**
     * 用户所有使用余额的变动方式
     *
     * @author mjf
     * @return List<Integer>
     */
    public static List<Integer> getChangeTypeUserDec() {
        List<Integer> list = new ArrayList<>();
        list.add(UM_DEC_PAY_ORDER.getCode());
        return list;
    }

}
